import 'package:flutter/material.dart';

enum ShapeStyle { rect, pill }

enum ColorStyle { gold, blue }

class PaypalButton extends StatelessWidget {
  final ShapeStyle shape;
  final ColorStyle colorStyle;
  final VoidCallback onPressed;

  PaypalButton(
      {required this.shape, required this.colorStyle, required this.onPressed});

  Color get _coloreTesto =>
      colorStyle == ColorStyle.gold ? Color(0xff0079C1) : Colors.white;

  Color get _coloreBottone =>
      colorStyle == ColorStyle.gold ? Color(0xffFFD700) : Color(0xff0079C1);

  OutlinedBorder get _shapeBottone => shape == ShapeStyle.rect
      ? RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))
      : StadiumBorder();

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Expanded(
          child: ElevatedButton(
              style: ElevatedButton.styleFrom(
                  primary: _coloreBottone, shape: _shapeBottone),
              onPressed: onPressed,
              child: Text(
                "Paypal",
                style: TextStyle(color: _coloreTesto),
              )),
        ),
      ],
    );
  }
}
